package com.cjk.controller;

import com.cjk.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 评论Controller
 */
@RestController
@RequestMapping("/test")
@Slf4j
public class TestController {
    //Logger log = LoggerFactory.getLogger(CommentController.class);
    //用Lombok Builder Helper提供的插件配上@Slf4j替代 就不用每次自己弄出来实例了

    @Autowired
    private IUserService userService;

    @RequestMapping(value = "/test", method = RequestMethod.GET)
    public String test() {
        int userTotal = userService.countUserTotal();
        log.trace("trace级别日志");
        log.debug("debug级别日志");
        log.info("info级别");
        log.warn("warn级别日志");
        log.error("error级别日志");
        // 查询一下用户总人数
        return "cjk-用户总人数:" + userTotal;
    }
}
